package 堆;

import java.util.ArrayList;

/**
 * @author shy_black
 * @date 2019/4/25 19:03
 * @Description:
 */
public class PriorityQueue<E extends Comparable<E>> implements Queue<E>{
    private MaxHeap<E> heap;

    public PriorityQueue() {
        heap = new MaxHeap<>();
    }
    @Override
    public int size() {
        return heap.size();
    }
    @Override
    public boolean isEmpty() {
        return heap.isEmpty();
    }
    @Override
    public E getFront() {
        return heap.peek();
    }
    @Override
    public void enqueue(E e) {
        heap.add(e);
    }
    @Override
    public E dequeue() {
        return heap.extractMax();
    }

}
